package ph.com.gs3.formalistics.model.communicators;

import java.util.HashMap;
import java.util.Map;

import ph.com.gs3.formalistics.model.valueobjects.application.APIResponse;
import ph.com.gs3.formalistics.model.valueobjects.application.APIResponse.APIInvalidResponseException;

public class NotificationCommunicatorModule extends HttpCommunicatorModule {

	public NotificationCommunicatorModule(HttpCommunicator communicator) {
		super(communicator);
	}

	public NotificationCommunicatorModule(HttpCommunicator communicator, String server) {
		super(communicator, server);
	}

	public APIResponse getNotifications(int startIndex, int fetchCount)
	        throws CommunicatorException, APIInvalidResponseException {

		commonValidation();

		String url = server + "/notifications";

		Map<String, String> requestParams = new HashMap<>();
		requestParams.put("start_index", Integer.toString(startIndex));
		requestParams.put("fetch_count", Integer.toString(fetchCount));

		return getResponse(url, requestParams);

	}

}
